﻿using Collection.Export.Interface;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WanPiJie;

namespace Collection.Export.Services.Wanpijie
{
    public class CatalogService : Service<Collection.Entities.Catalog>
    {
        public override Entities.Catalog Import(Entities.Catalog category)
        {
            if (WpjSf.CategoryService.HasCatalog(category.Id))
            {
                WpjSf.CategoryService.UpdateCatalog(category.Id, category.Name);
                this.OnUpdate(category);
            }
            else
            {
                WpjSf.CategoryService.AddCatalog(category.Id, category.Name);
                this.OnInsert(category);
            }
            return category;
        }
    }
}
